<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
$_SESSION["sessdata"]["pagefrom"]=$_SERVER["QUERY_STRING"];
?>

<div class="orgbar">
<p><b>Server Options:</b></p>
</div>
<table border="0" cellpaddingg="0" cellspacing="0">
<?
$serverInfo["serverID"] = $serverInfo["ID"];
$BigDaddyDisplay->ShowServerLine($serverInfo);
?>
</table>

<p class="categoryheader"><?=$pageParams["title"];?>: Monitoring</p>


<div class="orgbar"><span class="text"><b><?=$serverInfo["hostname"];?> Monitoring: <a href="<?=$_SERVER["PHP_SELF"];?>?page=ServerModAdd&serverID=<?=$_REQUEST["serverID"];?>">Add New</a></b></span></div>
<table border="0" cellpadding="0" cellspacing="0" width="97%">
<?

$aServerModules = $BigDaddyData->GetServerModulesByServerID($_REQUEST["serverID"]);

if (!is_array($aServerModules))
{
?>
	<tr valign="middle" align="center">
	<td width="100%" class="lineitem">
		No Monitoring Modules Set For This Server
	</td>
	</tr>

<?
}
else
{
	foreach ($aServerModules as $nIndex => $row)
	{
        $BigDaddyDisplay->ShowServerModuleLine($row, $_REQUEST["serverID"]);
	}
}
?>
</table>

<p class="categoryheader"><?=$pageParams["title"];?>: Details</p>


<table border="0" cellpadding="5" cellspacing="1" width="800">
<tr valign="top">
<td>

<table border="0" cellpadding="5" cellspacing="1" width="400" class="formtable">
<tr valign="top">
	<td class="formfielddesc">Hostname:</td>
	<td class="formfield">
		<?=$serverInfo["hostname"];?>
	</td>
</tr>

<tr valign="top">
	<td class="formfielddesc">Monitoring INI:<br />
	</td>
	<td class="formfield">
		<?
        
        $iniInfo = $BigDaddyData->GetIniInfoByID($serverInfo["iniID"]);
		?>	
		<a href="<?=$_SERVER["PHP_SELF"];?>?page=MonIniView&iniID=<?=$serverInfo["iniID"];?>"><?=$iniInfo["name"];?></a>
	</td>
</tr>


<tr valign="top">
	<td class="formfielddesc">Last External Monitor:<br />
	</td>
	<td class="formfield">
		<?
		if ($serverInfo["last_externalcheck"]>0)
		{
			echo get_time_str($serverInfo["last_externalcheck"], 2);
		}
		else
		{
			echo "Never";
		}

		?>	
	</td>
</tr>

<tr valign="top">
	<td class="formfielddesc">Notes:<br />
	</td>
	<td class="formfield">
		<?=$serverInfo["notes"];?>
	
	</td>
</tr>
</table>

</td>
<td>

	<table border="0" cellpadding="5" cellspacing="1" width="400" class="formtable">
	<tr valign="top">
	<td class="formfielddesc">Categories</td>
	</tr>
	<td class="formfield">
	
	<?
	
    $aServerCategories = $BigDaddyData->GetServerCategoriesByServerID($_REQUEST["serverID"]);
	
	if (is_array($aServerCategories))
	{
		foreach ($aServerCategories as $nIndex => $row)
		{
			echo $row["name"]."<br />";
		}
	}
	?>
	
	
	</td>
	</tr>
	<tr valign="top">
	<td class="formfielddesc">Details</td>
	</tr>
	<td class="formfield">
	Monitoring Information Retrieval From:<br />
	External: 
	<?
	if ($serverInfo["mon_externalreport"]==1)
	{
		echo "yes";
	}
	else
	{
		echo "no";
	}
	?><br /><br />
	
	Delayed Until: <?
	
	if ($serverInfo["delayed_until"]>0)
	{
		echo get_time_str($serverInfo["delayed_until"], 2);
	}
	else
	{
		echo "Not Delayed";
	}
	?><br />
	<?
	if ($serverInfo["mon_currentlevel"]>0)
	{
	?>
		Current Level: <?=$serverInfo["mon_currentlevel"];?><br />
	<?
	}
	?>
	<?
	if ($serverInfo["mon_currentlevelstart"]>0)
	{
	?>
		Current Level Started: <?=get_time_str($serverInfo["mon_currentlevelstart"], 2);?><br />
	<?
	}
	?>
	
	
	</td>
	</tr>
	</table>

</td>
</tr>
</table>

<br />

